/**
 * Created by win7 on 2017/3/15.
 */
import React from "react";
import "./css/CompanyManage.css";
import {hashHistory} from "react-router";
import Util from "../../util/Util"

export default class CheckboxPick extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            selectsingle: false,
            forbidstate: '',
            companyArr: [],
            statusContext: [],
            ccc: false,
            status: ''
        }
    }

    componentWillMount() {
        this.setState({
            statusContext: this.props.context
    })
    }

    touch(context, id, flag) {
        this.setState({
            selectsingle: !flag
        })
    }

    handleChange(context, indexnumber) {
        this.props.onmodal(context, indexnumber)
    }

    editcompany(context) {
        hashHistory.push('/EditCompany/' + context.enterpriseId)
    }

    viewCompany(context) {
        hashHistory.push('/ViewCompany/' + context.enterpriseId)
    }

    onchoose() {
        //更改禁用还是启用的状态
        this.setState({
            forbidstate: !this.state.forbidstate
        })
    }

    render() {
        return (
            <tr>
                {/*<div className="comManage_all comManage_title1">*/}
                {/*<Checkbox*/}
                {/*onChange={this.touch.bind(this, this.state.statusContext, this.props.indexnumber, this.state.selectsingle)}>*/}
                {/*<span className="bodrer1"></span>*/}
                {/*</Checkbox>*/}
                {/*</div>*/}
                <td>{this.state.statusContext.enterpriseId}</td>
                <td> <a title={this.state.statusContext.enterpriseName}
                        onClick={this.viewCompany.bind(this, this.state.statusContext)}>
                    {this.state.statusContext.enterpriseName}</a>
                </td>
                <td>{this.state.statusContext.serviceTypeName}</td>
                <td>{this.state.statusContext.employeeNum}</td>
                <td>
                        <span>{this.state.statusContext.userPhone}</span>
                </td>
                {/*<span className="comManage_title7">*/}
                {/*{*/}
                {/*this.state.statusContext.status == 2 ? '已激活' : this.state.statusContext.status == 1 ? '启用' : '禁用'*/}
                {/*}*/}
                {/*</span>*/}
                <td>{Util.dateFormat(this.state.statusContext.createTime)}</td>
                <td>
                    <span className="comManage_edit" style={!Util.authorityCheck("company") ? {display: 'none'} :{}}
                          onClick={this.editcompany.bind(this, this.state.statusContext)}></span>
                    {/*<span className="comManage_forbid"*/}
                    {/*onClick={this.handleChange.bind(this, this.state.statusContext, this.props.indexnumber)}>{this.state.statusContext.status == 0 ? '启用' : '禁用'}</span>*/}
                </td>
            </tr>
        )
    }
}